package com.mode.creating.factory;


public class SendFactory {
    //	 普通工厂模式
    public Sender produce(String type) {
        if ("mail".equals(type)) {
            return new MailSender();
        } else if ("sms".equals(type)) {
            return new SmsSender();
        } else {
            System.out.println("输入错误");
            return null;
        }
    }

    //	多个工厂方法
    public Sender produceMail() {
        return new MailSender();
    }

    public Sender produceSms() {
        return new SmsSender();
    }
//静态工厂
    public static Sender staticproduceMail(){
        return new MailSender();
    }

    public static Sender staticproduceSms(){
        return new SmsSender();
    }
}
